<!DOCTYPE html>
<html lang="en">

<head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1.0">
      <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
      <title>新闻网站</title>
      <style>
            .container {
                  display: -webkit-flex;
                  display: flex;
                  flex-direction: row;
                  justify-content: flex-start;
                  flex-wrap: wrap;
                  -webkit-flex-wrap: wrap;
                  align-content: flex-start;
            }

            .card {
                  width: 150px;
                  height: 100px;
                  border-radius: 10px;
                  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
                  text-align: center;
                  margin: 30px 20px;
                  border: 1px solid #ccc;
            }

            .card:hover {
                  border: 1px solid aqua;
            }
            a {
                  text-decoration: none;
            }

            .a_init {
                  color: #000000;
            }

            /* 未访问链接*/
            a:link {
                  color: #000000;
            }

            /* 已访问链接 */
            a:visited {
                  color: #00FF00;
            }

            /* 鼠标移动到链接上 */
            a:hover {
                  color: #FF00FF;
            }

            /* 鼠标点击时 */
            a:active {
                  color: #0000FF;
            }


            img {
                  width: 100%;
                  height: 100%;
                  border-radius: 10px;
            }

            .desc {
                  font-size: 20px;
            }

            @media screen and (max-width:768px) {
                  .card {
                        width: 60px;
                        height: 50px;
                  }

                  .desc {
                        font-size: 15px;
                  }
            }

            /* @media screen and (max-width: 400px) {
                  .card {
                        width: 50px;
                        height: 20px;
                  }

                  .desc {
                        font-size: 12px;
                  }

            } */
      </style>
</head>

<body>
      <div class="container">
            <div class="card">
                  <a target="_blank" href="https://news.baidu.com/">
                        <img src="imgs/baidu.png" alt="百度新闻">
                        <div class="desc">百度新闻</div>
                  </a>
            </div>

      </div>
</body>
<script>
      var websites = {
            "sites": [
                  {
                        "name": "人民日报",
                        "imgUrl": "imgs/people.png",
                        "url": "http://www.people.com.cn"
                  },
                  {
                        "name": "新华社",
                        "imgUrl": "imgs/xinhua.png",
                        "url": "http://www.xinhuanet.com"
                  },
                  {
                        "name": "央视新闻",
                        "imgUrl": "imgs/ysxw.png",
                        "url": "https://ysxw.cctv.cn/"
                  },
                  {
                        "name": "光明日报",
                        "imgUrl": "imgs/guangming.png",
                        "url": "http://www.gmw.cn"
                  },
                  {
                        "name": "中国新闻网",
                        "imgUrl": "imgs/chinaNews.png",
                        "url": "http://www.chinanews.com"
                  },
                  {
                        "name": "中国网",
                        "imgUrl": "imgs/zgw.png",
                        "url": "http://www.china.org.cn"
                  },
                  {
                        "name": "新浪新闻",
                        "imgUrl": "imgs/xinlang.png",
                        "url": "http://news.sina.com.cn"
                  },
                  {
                        "name": "搜狐新闻",
                        "imgUrl": "imgs/sohu.png",
                        "url": "http://news.sohu.com"
                  },
                  {
                        "name": "网易新闻",
                        "imgUrl": "imgs/wyxw.png",
                        "url": "http://news.163.com"
                  },
                  {
                        "name": "腾讯新闻",
                        "imgUrl": "imgs/txxw.png",
                        "url": "http://news.qq.com"
                  },
                  {
                        "name": "澎湃新闻",
                        "imgUrl": "imgs/pengpaiNews.png",
                        "url": "http://www.thepaper.cn"
                  },
                  {
                        "name": "财新网",
                        "imgUrl": "imgs/caixin.png",
                        "url": "http://www.caixin.com"
                  },
                  {
                        "name": "第一财经",
                        "imgUrl": "imgs/yicai.png",
                        "url": "http://www.yicai.com"
                  },
                  {
                        "name": "财经网",
                        "imgUrl": "imgs/caijing.png",
                        "url": "http://www.caijing.com.cn"
                  },
                  {
                        "name": "观察者网",
                        "imgUrl": "imgs/guancha.png",
                        "url": "https://www.guancha.cn"
                  },
                  {
                        "name": "界面新闻",
                        "imgUrl": "imgs/jiemian.png",
                        "url": "https://www.jiemian.com"
                  },
                  {
                        "name": "每日经济新闻",
                        "imgUrl": "imgs/mrjj.png",
                        "url": "http://www.nbd.com.cn"
                  },
                  {
                        "name": "21世纪经济报道",
                        "imgUrl": "imgs/21sj.png",
                        "url": "http://www.21jingji.com"
                  },
                  {
                        "name": "南方周末",
                        "imgUrl": "imgs/nfzm.png",
                        "url": "http://www.infzm.com"
                  },
                  {
                        "name": "新京报",
                        "imgUrl": "imgs/xjb.png",
                        "url": "http://www.bjnews.com.cn"
                  },
                  {
                        "name": "中国青年报",
                        "imgUrl": "imgs/cyol.png",
                        "url": "https://www.cyol.com"
                  },
                  {
                        "name": "中国日报网",
                        "imgUrl": "imgs/chinadaily.png",
                        "url": "http://www.chinadaily.com.cn"
                  },
                  {
                        "name": "参考消息",
                        "imgUrl": "imgs/cankaoxiaoxi.png",
                        "url": "http://www.cankaoxiaoxi.com"
                  },
                  {
                        "name": "环球网",
                        "imgUrl": "imgs/huanqiu.png",
                        "url": "https://www.huanqiu.com"
                  },
                  {
                        "name": "海外网",
                        "imgUrl": "imgs/haiwainet.png",
                        "url": "http://www.haiwainet.cn"
                  },
                  {
                        "name": "中国教育新闻网",
                        "imgUrl": "imgs/jyb.png",
                        "url": "http://www.jyb.cn"
                  },
                  {
                        "name": "健康报网",
                        "imgUrl": "imgs/jkb.png",
                        "url": "http://www.jkb.com.cn"
                  },
                  {
                        "name": "中国科技网",
                        "imgUrl": "imgs/stdaily.png",
                        "url": "http://www.stdaily.com"
                  },
                  {
                        "name": "法制网",
                        "imgUrl": "imgs/legaldaily.png",
                        "url": "http://www.legaldaily.com.cn"
                  },
                  {
                        "name": "中国体育报",
                        "imgUrl": "imgs/sports.png",
                        "url": "http://www.sports.cn"
                  }
            ]
      }
      $().ready(function () {
            $('.container').empty();
            console.log(websites['sites'])
            var sites = websites['sites'];
            //为.container动态添加新闻卡片
            for (var i = 0; i < sites.length; i++) {
                  var sites_card = $('<div class="card">' +
                        '<a target="_blank" href="' + sites[i].url + '">' +
                        '<img src="' + sites[i].imgUrl + '">' +
                        '</a>' +
                        '<div class="desc">' + sites[i].name + '</div>' +
                        '</div>');
                  console.log(sites_card)
                  $('.container').append(sites_card);
            }
      });

      document.oncontextmenu = new Function("event.returnValue=false");
      document.onselectstart = new Function("event.returnValue=false");
      document.oncontextmenu = function (e) { return false; }
      document.onkeydown = function (e) {
            if (window.event && window.event.keyCode == 123) {
                  event.keyCode = 0;
                  event.returnValue = false;
                  return false;
            }
      }
</script>

</html>